﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ServiceModel;
using System.Runtime.Serialization;

namespace EFCTP.Entity
{
    [Serializable]
    [Table("Industry")]
    [DataContract]
    public class Industry
    {
        #region Field
        private string _parentCode = "0";
        #endregion

       // [XmlElement("Industry_Code")]
        [Key, Column("IndustryCode")]
        [DataMember]
        public string Code { set; get; }

        //[XmlElement("Industry_Name")]
        [Required, Column("IndustryName")]
        [DataMember]
        public string Name { set; get; }

        //[XmlElement("Level_Value")]
        [Column("LevelValue")]
        [DataMember]
        public int? Level { set; get; }

        //[XmlElement("Parent_Code")]
        [DataMember]
        public string ParentCode { set; get; }

        //[XmlElement("Description")]
        [DataMember]
        public string Description { set; get; }

       // [XmlElement("Industry_Name_PY")]
        [Column("IndustryNamePY")]
        [DataMember]
        public string NamePY { set; get; }

        [ForeignKey("ParentCode")]
       // [XmlIgnore]
        [DataMember]
        public virtual Industry ParentIndustry { set; get; }

       // [XmlIgnore]
        [DataMember]
        public virtual ICollection<Industry> SubIndustries { set; get; }

       // [XmlIgnore]
        [DataMember]
        public virtual ICollection<Product> Products { set; get; }
    }
}
